package com.text.day3_3.homework;

import java.util.HashMap;

public class StringMap {
    public static void main(String[] args) {
        String str = "hello world";
        HashMap<Character, Integer> hashMap = new HashMap<>();
        char[] ch = str.toCharArray();
        for (char c : ch) {
            hashMap.put(c, hashMap.get(c) == null ? 1 : hashMap.get(c) + 1);
        }
        System.out.println(hashMap);
    }
}
